# 作者: 陈其志 
# 2025年02月18日15时39分49秒 
# 2716847110@qq.com

# 元组操作：不可变数据类型，省空间
def tuple_search_value(tuple_1, value):
    """
    元组根据值取索引
    :param tuple_1:
    :param value:
    :return:
    """
    print(tuple_1.index(value))


def tuple_search_index(tuple_1, index):
    """
    元组根据索引取值
    :param tuple_1:
    :param index:
    :return:
    """
    print(tuple_1[index])


def tuple_count(tuple_1):
    """
    统计包含元组的个数
    :param tuple_1:
    :return:
    """
    print(len(tuple_1))
    # 遍历元组
    for i in tuple_1:
        print(i)


def tuple_upack(tuple_1):
    info_str = "{} 年龄是：{} 身高是：{}".format(*tuple_1)  # 拆包
    print(info_str)


def tuple_to_list(tuple_1):
    list_1 = list(tuple_1)
    print(list_1)


if __name__ == '__main__':
    tuple_info = ('cqz', 24, 'zjz', 18, 24)
    info_tuple = ('cqz', 24, 1.78)
    # tuple_search_value(tuple_info, 'cqz')
    # tuple_search_index(tuple_info, 1)
    # tuple_count(tuple_info)
    # tuple_upack(info_tuple)
    tuple_to_list(tuple_info)
